<template>
	<view class="main">
		<view class="header">
			<text>失物招领</text>
			<image @click="fabu" id="tianjia" src="../../static/icons/tianjia.png"></image>
		</view>
		<view v-for="(item,index) in arr" class="content">
			<view class="user">
				<image :src="item.avatarurl" class="touxiang"></image>
				<text class="username">{{item.username}}</text>
				<text class="date">{{item.date}}</text>
			</view>
			<view @click="xiangqing(arr[index].id)" class="write">
				<text class="title">{{item.last_found_title}}</text>
				<text class="body">{{item.last_found_withtitle}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				arr: [
					// {
					// 	"touxiang": "../../static/logo.png",
					// 	"username": "韩梅梅",
					// 	"date": "13:22",
					// 	"title": "钥匙招领",
					// 	"write": "开学第一天，感谢师兄鼎力相助！不然这么多东西我还真办不回去"
					// }
				]
			}
		},
		methods: {
			fabu() {
				uni.navigateTo({
					url: '../shiwuzhaoling/fabu'
				});
			},
			xiangqing(id) {
				uni.navigateTo({
					url: '../shiwuzhaoling/xiangqing?id='+id
				});
			},
			//加载
			Refresh() {
				this.$http({
					url: "/lastfound/findAllLastFound",
					method: "get",
				}).then(res => {
					this.arr = res.data.data;
					console.log(this.arr);
				})
			},
			onLoad() {
				this.Refresh();
			},
		}
	}
</script>

<style lang="less" scoped>
	.main {
		margin: 30rpx;
	}

	.header {
		font-size: 46rpx;
		display: flex;
		justify-content: space-between;

	}

	#tianjia {
		width: 46rpx;
		height: 46rpx;
	}

	.content {
		margin: 30rpx 0;
		border-bottom: solid 2rpx #ebebeb;
	}

	.user {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.touxiang {
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
		margin-right: 20rpx;
	}

	.username {
		flex: 1;
		font-size: 32rpx;
		font-weight: bolder;
	}

	.date {
		font-size: 24rpx;
		color: #717171;
	}
	
	.write {
		margin: 0 0 0 100rpx;
		display: flex;
		flex-wrap: wrap;
	}

	.title {
		width: 100%;
		font-weight: bold;
		margin-bottom: 15rpx;
	}
	.body {
		color: #717171;
		margin-bottom: 20rpx;
	}
</style>
